package com.ddd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ddd.pojo.BookHisInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookHisInfoMapper extends BaseMapper<BookHisInfo> {

    // 关联查询借阅记录及借书人姓名
    @Select("SELECT h.*, u.name AS userName " +
            "FROM book_his_info h " +
            "LEFT JOIN user_info u ON h.aid = u.aid")
    List<BookHisInfo> selectWithUserName();
}